﻿using FastMvc;
using System;
using System.Collections.Generic;
using System.Text;
using JQ.SAAS.IService;
using FastMvc.Models;
using JQ.SAAS.DTO.SysPermissions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using FastMvc.Auth;

namespace JQ.SAAS.WebServer.Controllers
{
    /// <summary>
    /// 系统权限
    /// </summary>
    [ApiController]
    [Route("api/SysPermissions")]
    [PermissionCheck("Admin.Sys.Permission","系统权限管理")]
    public class SysPerimissionController : BaseController
    {
        private ISysPermissionService _pService;
        public SysPerimissionController(ISysPermissionService sysPermissionService)
        {
            _pService = sysPermissionService;
        }

        /// <summary>
        /// 获取全部权限
        /// </summary>
        /// <returns></returns>
        [HttpGet("")]
        public async Task<BaseResult<List<PermissionDto>>> GetAllSysPermission()
        {
            var all = await _pService.GetAllPermisions();

            return await SetResultNotNull(all);
        }
    }
}
